
<script setup>
import { ref, watch } from "vue";
// const count = ref(0);
// const age = ref(0);
//侦听单个数据
// watch([count], (newValue, oldValue) => {
//   console.log(`count发生了变化，老值为${oldValue},新值为${newValue}`);
// });
const count = ref(0);
const age = ref(0);


//复杂类型侦察
const person = ref({
  name: "张三",
  age: 18,
  toy: {
    name: "小玩具",
  }
})
const person1 = ref({
  name:'张ww三',
  age:18,
  toy:{
    name:'玩具'
  }
})


watch([person], (newValue, ) => {
  console.log(newValue);
}, {
  deep: true
});

</script>
<template>
  <div>
    {{ count }}
   {{ age }}  
    
  </div>
</template>
<style scoped>
</style>

